﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using PlanningGIS.Win.Controls;
using PlanningGIS.Util;
using PlanningGIS.Framework;

namespace PlanningGIS.DataConvert
{
    /// <summary>
    /// DLG数据入库
    /// </summary>
    public partial class FrmDLGImp : Office2007Form
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public FrmDLGImp()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 加载窗体
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmDLGImp_Load(object sender, EventArgs e)
        {

        }

        /// <summary>
        /// 入库
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnImp_Click(object sender, EventArgs e)
        {
            btnImp.Enabled = false;
            FrameworkHelper.ShowLogPanel();
            try
            {
                ctlImpFCode.Import();
            }
            catch (Exception ex)
            {
            }
            finally
            {
                btnImp.Enabled = true;
            }            
            
        }

        /// <summary>
        /// 终止
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnStop_Click(object sender, EventArgs e)
        {
            if (MsgHelper.ShowYesOrNoQueryMsgBox("正在进行入库，是否确定终止入库？") == DialogResult.Yes)
            {
                ctlImpFCode.Stop();
                btnImp.Enabled = true;
            }     
        }
        
        /// <summary>
        /// 退出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnExit_Click(object sender, EventArgs e)
        {
            
            this.Close();
        }

        /// <summary>
        /// 退出前先停止入库操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmDLGImp_FormClosing(object sender, FormClosingEventArgs e)
        {
            ctlImpFCode.Stop();
        }

    }
}
